<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-26 16:55:58
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-26 17:26:43
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
          
            position: fixed;
            top: 50%;
            left: 50%;
            width: 944px;
            height: 290px;
            margin-top: -145px;
            margin-left: -472px;
            background: #fff;
            z-index: 1113;
            box-shadow: 0 2px 10px 0 rgba(0,0,0,.1);
            border-radius: 16px;
            display: none;
          
        }
        .box-content{
            padding: 16px 24px 0 24px;
        }
        .img1,.img2,.img3{
            float: left;
            width: 240px;
            height: 250px;
            margin-left: 50px;
            cursor: pointer;
        }
        .img1 img, .img2 img, .img3 img{
            height: 100%;
            width: 100%;
        }
    </style>
</head>
<body>
    <button id="btn">点击换肤</button>
    <div class="box">
        <div class="box-content">
        <div class="img1"><img src="./images/1.jpg" alt=""></div>
        <div class="img2"><img src="./images/2.jpg" alt=""></div>
        <div class="img3"><img src="./images/3.jpg" alt=""></div>
    </div>
    </div>
    <script>
        var btn = document.querySelector("#btn");
        var box = document.querySelector(".box");
        var img1 = document.querySelector(".img1");
        var img2 = document.querySelector(".img2");
        var img3 = document.querySelector(".img3");
        btn.onclick = function(){
            box.style.display="block";
        }
        img1.onclick = function(){
            document.body.style.background ="url(./images/1.jpg) no-repeat";
            box.style.display="none";
        }
        img2.onclick = function(){
            document.body.style.background ="url(./images/2.jpg) no-repeat";
            box.style.display="none";
        }
        img3.onclick = function(){
            document.body.style.background ="url(./images/3.jpg) no-repeat";
            box.style.display="none";
        }
    </script>
</body>
</html>